﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class PackHeroMgr
{
    private readonly Dictionary<long, Hero> Heros;

    public PackHeroMgr()
    {
        Heros = new Dictionary<long, Hero>();
    }

    /// <summary>
    /// 添加
    /// </summary>
    public void Add(Hero hero)
    {
        Heros.Add(hero.id, hero);
    }

    /// <summary>
    /// 获取
    /// </summary>
    public bool TryGet(long heroId, out Hero hero)
    {
        return Heros.TryGetValue(heroId, out hero);
    }

    /// <summary>
    /// 移除
    /// </summary>
    public void Remove(long heroId)
    {
        Heros.Remove(heroId);
    }

    /// <summary>
    /// 获取所有
    /// </summary>
    public List<Hero> GetAll()
    {
        return Heros.Values.ToList();
    }
}
